dict1 = {
    "name": "张三",
    "age": 18,
    "sex": "男",
}
# print(dict1["name1"])
# print(dict1.get("name1"))
if dict1.get("name1")=="张三":
    print("存在")




# # 获取所有键
# keys = dict1.keys()
# print(keys)
# # 获取所有值
# values = dict1.values()
# print(values)
# # 获取所有键值对
# items = dict1.items()
# print(items)
# # 获取字典长度
# length = len(dict1)
# print(length)

# dict1["address"] = "长沙市"
# dict1.update(
#     {"phone": "12345678901"}
# )
# print(dict1)

# -删
# --用del语句---del dict1['key']
# del dict1["name"]
# print(dict1)
# --使用pop()方法（返回被删除的值）
# print(dict1.pop("age"))
# print(dict1)
# --清空字典.clear()
# dict1.clear()
# print(dict1)
# --删除整个字典-- del dict1
# del dict1
# print(dict1)
